package com.example.tests;

import com.example.framework.Folders;
import org.testng.annotations.Test;

import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;

public class FolderCreationTest extends TestManager {

    @Test
    public void shouldCreateFolderWIthUniqueName(){
        String folder = "newFolder";
        Folders oldFolders = manager.getFolderHelper().getFolders();
        manager.getFolderHelper().createFolder(folder);
        Folders newFolders = manager.getFolderHelper().getFolders();
        assertThat(newFolders, equalTo(oldFolders.withAdded(folder)));
    }

    @Test
    public void shouldNotCreateFolderWIthDuplicatedName(){
        String folder = "newFolder1";
        assertThat(manager.getFolderHelper().createFolder(folder), is(nullValue()));
        assertThat(manager.getFolderHelper().createFolder(folder), containsString("Duplicated folder name"));
    }
}
